package com.zygh.lz.dao.app;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zygh.lz.entity.app.AppTrailerAbnormalCause;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface AppTrailerAbnormalCauseMapper extends BaseMapper<AppTrailerAbnormalCause> {


    @Select("<script> " +
            "select count(type) count, abnormal_cause,type\n" +
            "from app_trailer_abnormal_cause atac\n" +
            "         left join app_trailer_info ati on atac.code = ati.code\n" +
            "where ati.is_del = 0\n" +
            "  and ati.section_id in" +
            "<foreach collection='dep' item='item' open='(' separator=',' close=')'>" +
            "   #{item}" +
            "</foreach>" +
            "and create_time between #{startTime} and #{endTime} " +
            "group by type;" +
            " </script>")
    List<Map<String, Object>> getAbnormalCount(
            @Param("dep") List<Integer> dep,
            @Param("startTime") String startTime,
            @Param("endTime") String endTime);


}
